<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
	xmlns:uml="http://schema.omg.org/spec/UML/2.0" xmlns:str="http://exslt.org/strings"
	xmlns:xsltsl-str="http://xsltsl.org/string" xmlns:mylib="http://mylib"
	extension-element-prefixes="xsltsl-str str mylib">

	<xsl:import href="../../xsltlib/xsltsl-1.2.1/string.xsl" />
	<xsl:import href="../../xsltlib/exsltlib/str/str.xsl" />
	<xsl:import href="mylib.xsl" />

	<xsl:output method="xml" encoding="UTF-8" />

	<xsl:template match="@* | node()">
		<xsl:copy>
			<xsl:apply-templates select="@* | node()" />
		</xsl:copy>
	</xsl:template>
	
	
<xsl:template name="mylib:rewriteType">
		<xsl:param name="stringIn" />
		<xsl:variable name="r1">
			<xsl:call-template name="mylib:replaceCharsInString">
				<xsl:with-param name="stringIn" select="$stringIn" />
				<xsl:with-param name="charsIn" select="'EString'" />
				<xsl:with-param name="charsOut" select="'aaaa'" />
			</xsl:call-template>
		</xsl:variable>
		<xsl:variable name="r2">
			<xsl:call-template name="mylib:replaceCharsInString">
				<xsl:with-param name="stringIn" select="$r1" />
				<xsl:with-param name="charsIn" select="'EDouble'" />
				<xsl:with-param name="charsOut" select="'bbbb'" />
			</xsl:call-template>
		</xsl:variable>
		<xsl:variable name="r3">
			<xsl:call-template name="mylib:replaceCharsInString">
				<xsl:with-param name="stringIn" select="$r2" />
				<xsl:with-param name="charsIn" select="'Edate'" />
				<xsl:with-param name="charsOut" select="'cccc'" />
			</xsl:call-template>
		</xsl:variable>
		<xsl:variable name="r4">
			<xsl:call-template name="mylib:replaceCharsInString">
				<xsl:with-param name="stringIn" select="$r3" />
				<xsl:with-param name="charsIn" select="'EInt'" />
				<xsl:with-param name="charsOut" select="'dddd'" />
			</xsl:call-template>
		</xsl:variable>

		<xsl:value-of select="$r4" />

	</xsl:template>
	

	<xsl:template match="packagedElement/ownedAttribute/type/@href">
		<xsl:attribute name="href">
         <xsl:call-template name="rewriteType">
				<xsl:with-param name="stringIn" select="." />
			</xsl:call-template>
        </xsl:attribute>
	</xsl:template>
	
</xsl:stylesheet>